package spring.demo.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import spring.demo.entity.Course;

@Mapper
public interface CourseMapper {

    @Select("select * from COURSE where CNO = #{courseId}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "teacher", column = "TNO", one = @One(select = "spring.demo.mapper.TeacherMapper.findTeacherById"))
    })
    Course findCourseById(String courseId);

}
